const requset = require("./requset");

exports.getUser = function getUser(params) {
  return requset({
    method: "get",
    url: `/user`
  });
}

exports.getGroupInfo = function getGroupInfo(loginOrId) {
  return requset({
    method: "get",
    url: `/users/${loginOrId}/groups `
  });
}

exports.getRepos = function getRepos(userId) {
  return requset({
    method: "get",
    url: `/users/${userId}/repos`,
    params: {
      type: 'all'
    },
  });
}

exports.getDocs = function getDocs(docid) {
  return requset({
    method: "get",
    url: `/repos/${docid}/docs`,
    params: {},
  });
}

exports.getDocsDetails = function getDocsDetails(docid, slug) {
  return requset({
    method: "get",
    url: `/repos/${docid}/docs/${slug}`,
    params: {
      raw: 1,
    },
  });
}